package hhm.android.library.netWorkState

import android.content.Intent
import android.os.Bundle
import android.provider.Settings
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import hhm.android.library.R

class NetWorkDialog : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_no_network)

        if (intent?.getIntExtra("type", 1) == 1) {
            finish()
        }

        val btn = findViewById<TextView>(R.id.activity_no_network_btn)
        btn.setOnClickListener {
            val intent = Intent(Settings.ACTION_SETTINGS)
            startActivity(intent)
            finish()
        }
    }

    override fun onNewIntent(intent: Intent?) {
        super.onNewIntent(intent)
        if (intent?.getIntExtra("type", 1) == 1) {
            finish()
        }
    }

    override fun onBackPressed() {
    }
}